import React from 'react'
import { Form, Button, DatePicker } from 'antd'
import colors from '@/constants/colors'
import '../batchRecord/search.css'
import { disabledStartDate, disabledEndDate } from '../batchRecord/Search'

const FormItem = Form.Item
const { MonthPicker } = DatePicker

const MonthSendStatiticsSearch = (props) => {

  const inputLayout = { style: { width: 120 }}

  const {
    endTime,
    startTime,
    onChangeStartTime,
    onChangeEndTime,
    onSearch,
  } = props

  return (
    <Form layout="inline" style={{ padding: 24 }}>
      <FormItem label="开始月份" >
        <MonthPicker 
          {...inputLayout} 
          defaultValue={startTime}
          onChange={onChangeStartTime} 
          disabledDate={disabledStartDate.bind(null, endTime)}
        />
      </FormItem>
      <FormItem label="结束月份" >
        <MonthPicker 
          {...inputLayout} 
          defaultValue={endTime}
          onChange={onChangeEndTime} 
          disabledDate={disabledEndDate.bind(null, startTime)}
        />
      </FormItem>
      <FormItem>
        <Button type="primary" onClick={onSearch}>查询</Button>
      </FormItem>
    </Form>
  )
}



export default Form.create()(MonthSendStatiticsSearch)